/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.glance.wear.tiles.template.demos

import androidx.compose.runtime.Composable
import androidx.glance.ImageProvider
import androidx.glance.template.HeaderBlock
import androidx.glance.template.ImageBlock
import androidx.glance.template.SingleEntityTemplateData
import androidx.glance.template.TemplateImageWithDescription
import androidx.glance.template.TemplateText
import androidx.glance.template.TextBlock
import androidx.glance.template.TextType
import androidx.glance.wear.tiles.GlanceTileService
import androidx.glance.wear.tiles.template.SingleEntityTemplate

/** Simple demo tile, displays [SingleEntityTemplate] */
class DemoTile : GlanceTileService() {

    @Composable
    override fun Content() {
        SingleEntityTemplate(
            SingleEntityTemplateData(
                headerBlock =
                    HeaderBlock(
                        text = TemplateText("Single Entity Demo", TextType.Title),
                        icon =
                            TemplateImageWithDescription(ImageProvider(R.drawable.compose), "image"),
                    ),
                textBlock =
                    TextBlock(
                        text1 = TemplateText("Title", TextType.Title),
                        text2 = TemplateText("Subtitle", TextType.Label),
                        text3 = TemplateText("Here's the body", TextType.Body),
                        priority = 0,
                    ),
                imageBlock =
                    ImageBlock(
                        images =
                            listOf(
                                TemplateImageWithDescription(
                                    ImageProvider(R.drawable.compose),
                                    "image",
                                )
                            ),
                        priority = 1,
                    ),
            )
        )
    }
}
